<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page import="org.apache.commons.fileupload.servlet.*"%>
<%@ page import="com.scand.fileupload.*"%>
<%@ page import="java.util.*"%>
<jsp:directive.page import="com.toncen.samepms.basic.action.DocumentsUploadAction"/>
<jsp:directive.page import="com.sky.common.http.HTTPUtils"/>
<%
	boolean isMultipart = FileUpload.isMultipartContent(request);
	if (!isMultipart) {

		out.println("Use multipart form to upload a file!");

	} else {
		String fileId = request.getParameter("sessionId").toString().trim();

		// Create a new file upload handler
		FileItemFactory factory = new ProgressMonitorFileItemFactory(request, fileId);
		ServletFileUpload upload = new ServletFileUpload(factory);

		// Parse the request
		List items = upload.parseRequest(request);
		DocumentsUploadAction uploadFile = new DocumentsUploadAction();
		String fileType = HTTPUtils.getRequestParameter(request,"fileType");//文件类型
		String businessType =  HTTPUtils.getRequestParameter(request,"businessType");//文件业务类型
		String fileGrade = HTTPUtils.getRequestParameter(request,"fileGrade");//文件级别
		uploadFile.saveFile(items, request,fileType,fileGrade,businessType);
	}
%>
